<template>
  <div class="edit-main-pic-warpper">
    <el-form
      ref="ruleform"
      :inline="true"
      :model="form"
      :rules="rules"
      label-width="100px"
    >
      <el-form-item label="" label-width="84">
        <div style="display: flex;">
          <el-radio v-model="form.edit_type" label="0" style="padding-top: 23px;">增加详情图：</el-radio>
          <div class="display: flex;">
            <div style="display: flex; align-items: center;">
              <span style="margin-right: 12px;">首部图片</span>
              <el-upload
                action="https://jsonplaceholder.typicode.com/posts/"
                list-type="picture-card"
                :on-remove="handleRemove"
                style="display: flex;"
              >
                <i class="el-icon-plus" />
              </el-upload>
              <el-button type="danger" plain style="margin-left: 12px;">清除</el-button>
              <span style="margin-left: 12px; color: #999999;">最多添加10张</span>
            </div>
            <div style="display: flex; align-items: center; margin-top: 12px;">
              <span style="margin-right: 12px;">尾部图片</span>
              <el-upload
                action="https://jsonplaceholder.typicode.com/posts/"
                list-type="picture-card"
                :on-remove="handleRemove"
                style="display: flex;"
              >
                <i class="el-icon-plus" />
              </el-upload>
              <el-button type="danger" plain style="margin-left: 12px;">清除</el-button>
              <span style="margin-left: 12px; color: #999999;">最多添加10张</span>
            </div>
          </div>
        </div>
        <div style="display: flex; align-items: center; margin-top: 12px;">
          <el-radio v-model="form.edit_type" label="1">删除详情图：</el-radio>
          <div>
            <el-checkbox v-model="form.is_del_img_before" style="margin-right: 40px;">
              <span style="color: #000;">
                删除前
                <el-input v-model="form.del_img_before_num" size="mini" placeholder="请输入" style="width: 100px; margin: 0 6px;" />
                张图
              </span>
            </el-checkbox>
            <el-checkbox v-model="form.is_del_img_after" style="margin-right: 40px;">
              <span style="color: #000;">
                删除后
                <el-input v-model="form.del_img_after_num" size="mini" placeholder="请输入" style="width: 100px; margin: 0 6px;" />
                张图
              </span>
            </el-checkbox>
            <el-checkbox v-model="form.reserve" style="margin-right: 0;">
              <span style="color: #000;">
                最少保留
                <el-input v-model="form.reserve_count" size="mini" placeholder="请输入" style="width: 100px; margin: 0 6px;" />
                张图
              </span>
            </el-checkbox>
          </div>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      pageInfo: {
      },
      form: {
        edit_type: 0,
        // 前3项
        add_urls: [],
        is_del_img_before: false,
        del_img_before_num: '',
        is_del_img_after: false,
        del_img_after_num: '',
        reserve: false,
        reserve_count: ''
      },
      rules: {}
    }
  },
  methods: {
    addDomain() {
      this.form.replaceKeywords.push({
        replaceBefore: '',
        replaceAfter: ''
      })
    },
    removeDomain(item) {
      var index = this.form.replaceKeywords.indexOf(item)
      if (index !== -1) {
        this.form.replaceKeywords.splice(index, 1)
      }
    },
    handleRemove(file, fileList) {
      console.log(file, fileList)
    }
  }
}
</script>

<style lang="scss" scoped>
p {
  margin: 0;
  line-height: 17px;
}
.edit-main-pic-warpper {
  ::v-deep {
    .el-radio {
      margin-right: 0;
    }
    .el-upload {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 60px;
      height: 60px;
    }
    .el-upload-list__item {
      width: 60px;
      height: 60px;
    }
  }
  .replace-keywords-row {
    ::v-deep {
      .el-form-item {
        &:first-of-type .el-form-item__label {
          opacity: 1;
        }
        .el-form-item__label {
          opacity: 0;
        }
      }
    }
  }
  .keywords-textarea {
    ::v-deep {
      .el-textarea {
        width: 800px;
      }
      .el-textarea__inner {
        height: 80px;
        background-color: #F7F8FA;
        border: none;
      }
    }
  }
  .middle-type::v-deep.el-select {
    width: 240px;
  }
}
</style>
